<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <title>使用特性检测</title>
</head>
<body>
<script>
    function success(position) {
        var crds = position.coords;
        var latiude = crds.latitude;
        var longitude = crds.longitude;
        var altitude = crds.altitude;
        var message = 'You\'re at ' + latiude + ', ' + longitude + ', ' + altitude;
        alert(message);
    }

    function error(e) {
        alert(e.message);
    }

    if (typeof navigator.geolocation != 'undefined') {
        navigator.geolocation.getCurrentPosition(success, error);
    } else {
        alert('This page uses geolocation, and your browser doesn\'t support it.');
    }
</script>
</body>
</html>